package karma.main;

import net.minecraft.client.Minecraft;
import net.minecraft.src.*;

public class ItemELBoots extends ItemArmor
{
    public static boolean allowJump;
    public static boolean allowNoFall;

    public ItemELBoots(int i, EnumArmorMaterial enumarmormaterial, int j, int k)
    {
        super(i, enumarmormaterial, j, k);
    }

    public static void checkIfWorn(Minecraft minecraft)
    {
        if (minecraft.thePlayer.inventory.armorInventory[0] != null && minecraft.thePlayer.inventory.armorInventory[0].getItem() == mod_KarmaCraft.ELBoots)
        {
            doSpecial(minecraft);
        }
    }

    public static void doSpecial(Minecraft minecraft)
    {
        if (!minecraft.thePlayer.onGround && allowJump && !minecraft.thePlayer.isSneaking())
        {
            minecraft.thePlayer.setVelocity(minecraft.thePlayer.motionX, minecraft.thePlayer.motionY * 2.0499999999999998D, minecraft.thePlayer.motionZ);
            allowJump = false;
        }

        if ((float)(int)minecraft.thePlayer.fallDistance >= 3F && allowNoFall)
        {
            minecraft.thePlayer.fallDistance = 0.0F;
            minecraft.thePlayer.inventory.armorInventory[0].damageItem(2, minecraft.thePlayer);
            allowNoFall = false;
        }

        if (minecraft.thePlayer.onGround)
        {
            allowJump = true;
            allowNoFall = true;
        }
    }

    /**
     * Return an item rarity from EnumRarity
     */
    public EnumRarity getRarity(ItemStack itemstack)
    {
        return mod_KarmaCraft.ENCHANTED;
    }
}
